import pandas as pd
import re

df = pd.read_csv('../static/data/scenic_spots_info.csv')
df['地址'] = df['地址'].apply(lambda x: x.replace('\r\n', '').replace(' ', ''))
df['星级'] = df['星级'].apply(lambda x: re.findall('[0-9]{2}', x)[0])
df['星级'] = df['星级'].apply(lambda x: int(x) / 20)
df['评论数'] = df['评论数'].apply(lambda x: x.replace('\r\n', '').replace(' ', '')[1:-4]).astype(int)
df['评论'] = df['评论'].apply(lambda x: x.replace('\r\n', '').replace(' ', ''))
df.to_csv('../static/data/scenic_spots_info_clean.csv', index=False)
